Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reader: partly restore the previous behaviour #16

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

mkmkme
Copy link
Collaborator

@mkmkme mkmkme commented Aug 2, 2024

Version 3.0.0 changed the way sets and maps are handled in libvalkey-py. Now, all the sets and dicts were treated as lists, maps being lists of tuples. This change was done without keeping valkey-py in mind. As it turned out, this way of handling maps is not really applicable to valkey-py because valkey-py doesn't know what data type it expects. Hence, it can't tell whether the returned list should be treated as a map or left as it is.

This commit partly reverts the behaviour to what it was pre-3.0.0, leaving maps as dicts all the time. All sets, though, are being treated as lists now when convertSetsToLists=True. While this behaviour excludes some exotic use cases allowed by RESP like set or array being a key of a map, it does not affect the consumer library as much, and none of such exotic use cases are being used in the real world anyway.

Version 3.0.0 changed the way sets and maps are handled in libvalkey-py.
Now, all the sets and dicts were treated as lists, maps being lists of
tuples. This change was done without keeping `valkey-py` in mind. As it
turned out, this way of handling maps is not really applicable to
`valkey-py` because `valkey-py` doesn't know what data type it expects.
Hence, it can't tell whether the returned list should be treated as a
map or left as it is.

This commit partly reverts the behaviour to what it was pre-3.0.0,
leaving maps as dicts all the time. All sets, though, are being treated
as lists now when `convertSetsToLists=True`. While this behaviour
excludes some exotic use cases allowed by RESP like set or array being a
key of a map, it does not affect the consumer library as much, and none
of such exotic use cases are being used in the real world anyway.

Signed-off-by: Mikhail Koviazin <[email protected]>
@mkmkme mkmkme merged commit bef209c into main Aug 2, 2024
28 checks passed
@mkmkme mkmkme deleted the mkmkme/fix-return-value branch August 2, 2024 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants